home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_15_1987_Transactor_Publishing.d64
/
eprom prg 64
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
6KB
|
222 lines
1 rem** program by tim bolbach / graphics by rich bozman **
2 poke56835,128:poke56834,254:poke57091,255:poke53281,11:poke53280,0
3 rv$=chr$(18): sp$=rv$+" "
4 co=36:li=24:gosub260:print chr$(147)chr$(144)
7 fort=1 to 21
9 next t
12 poke2020,195
13 poke2021,195
14 poke2022,195
15 poke2023,253
17 print"[147]"spc(9)"eprom handler menu"
19 print" 1 list eprom on screen"
20 print" 2 program eprom"
21 print" 3 write eprom to disk"
22 print" 4 verify eprom with disk"
23 print" 5 check for erasure"
24 print" 6 directory"
25 print" 7 list disk file to screen"
26 print" logo [146] = commodore key"
27 poke198,0:wait198,1:geta$
28 a=val(a$):ifa<1ora>7then27
29 onagoto30,62,101,138,182,214,240
30 rem *** read eprom ***
31 c$="0123456789abcdef"
33 print"[147]"spc(8)"list eprom on screen"
35 print"shift=pause[146] shift lock=hold[146] logo=menu"
36 a=0:poke56835,128:poke57091,255:rem**** set ports for read ******
37 poke56834,254
38 ad=a
39 gosub 54
40 print rv$;"$";a$;":[146] ";
41 for t=0 to 7
42 ah=int((ad+t)/256):al=(ad+t)-(ah*256)
43 poke56832,al :poke56833,ah
44 poke 56834,8
45 d=peek(57089)
46 poke56834,254
47 gosub 59
48 print d$;" ";
49 next t
50 print
51 onpeek(653)goto51,2
52 a=a+8
53 goto 38
54 d1=int(a/4096):x=a-(d1*4096)
55 d2=int(x/256):x=x-(d2*256)
56 d3=int(x/16):d4=x-(d3*16)
57 a$=mid$(c$,d1+1,1)+mid$(c$,d2+1,1)+mid$(c$,d3+1,1)+mid$(c$,d4+1,1)
58 return
59 d1=int(d/16):d2=d-(d1*16)
60 d$=mid$(c$,d1+1,1)+mid$(c$,d2+1,1)
61 return
62 rem *** burn eprom ***
63 print"[147]";:poke56835,128:poke56834,254:poke57091,128
65 print spc(13)"burn eprom"
67 gosub 1000
75 x=((2^a)*1024)-1
76 input"file name";n$
77 open8,8,8,n$+",p,r"
78 open15,8,15
79 get#15,a$,b$
80 er=val(a$+b$)
81 print"";a$+b$;
82 get#15,a$:printa$;:ifa$=chr$(13)then84
83 goto82
84 ifer>0thenclose8:close15: fort=1 to 1000:next t:goto2
85 printspc(7)"press key when ready":poke198,0:wait198,1
86 get#8,a$:get#8,a$:rem ** get rid of file address ***
87 poke56834,255:fort=1 to 1000:nextt
88 printspc(12)"location:":printspc(13)"logo = abort"
89 forc=0 to x:li=19:co=21:gosub260:
90 printleft$(sp$,7-len(str$(c)))c
91 get#8,d$:ifd$=""thend$=chr$(0)
92 d=asc(d$)
93 ah=int(c/256):al=c-(ah*256)
94 poke56832,al:poke56833,ah
95 poke57089,d
96 poke56834,5
97 poke56834,255
98 ifpeek(653)=2thenc=x
99 next c
100 poke56834,254:poke57091,255:close8:close15:goto2
101 rem *** write eprom to disk ***
102 print"[147]";:poke56835,128:poke56834,254:poke57091,255
104 print spc(9)"write eprom to disk"
106 gosub 1000
114 x=((2^a)*1024)-1
115 input"file name";n$
116 open8,8,8,n$+",p,w"
117 open15,8,15
118 get#15,a$,b$
119 er=val(a$+b$):printa$;b$;
120 get#15,a$:printa$;:ifa$=chr$(13)then122
121 goto120
122 ifer>0thenclose8:close15: fort=1 to 1000:next t:goto2
123 printspc(7)"press key when ready":poke198,0:wait198,1
124 poke56834,254:fort=1 to 400:nextt
125 printspc(12)"location:":printspc(13)"logo = abort"
126 print#8,chr$(0);:print#8,chr$(0); :rem ** put in fake file address **
127 forc=0 to x:li=18:co=21:gosub260:
128 printleft$(sp$,7-len(str$(c)))c
129 ah=int(c/256):al=c-(ah*256)
130 poke56832,al:poke56833,ah
131 poke56834,8
132 d=peek(57089)
133 poke56834,254
134 d$=chr$(d):print#8,d$;
135 ifpeek(653)=2thenc=x
136 nextc
137 poke56834,254:poke57091,255:close8:close15:goto2
138 rem *** verify eprom with disk ***
139 print"[147]";:poke56835,128:poke56834,254:poke57091,255
141 print"[147]"spc(7)"verify eprom with disk"
143 gosub 1000
151 x=((2^a)*1024)-1
152 input"file name";n$
153 open8,8,8,n$+",p,r"
154 open15,8,15
155 get#15,a$,b$
156 er=val(a$+b$):printa$;b$;
157 get#15,a$:printa$;:ifa$=chr$(13)then159
158 goto157
159 ifer>0thenclose8:close15: fort=1 to 1000:next t:goto2
160 printspc(7)"press key when ready":poke198,0:wait198,1
161 poke56834,254:fort=1 to 400:nextt
162 printspc(12)"location:":printspc(13)"logo = abort"
163 get#8,a$:get#8,a$:rem ** get fake file address out of the way*
164 forc=0 to x
165 li=18:co=21:gosub260:
166 printleft$(sp$,7-len(str$(c)))c
167 ah=int(c/256):al=c-(ah*256)
168 poke56832,al:poke56833,ah
169 poke56834,8
170 d=peek(57089):print" "left$(sp$,5-len(str$(d)))
171 poke56834,254
172 get#8,a$:ifa$=""thena$=chr$(0)
173 a=asc(a$):ifa<>d then 180
174 ifpeek(653)=2thenc=x
175 next c
176 poke56834,254:poke57091,255:close8:close15:goto2
177 print"[147] eprom program verified [146]"
178 printspc(4)"press any key to continue":poke198,0:wait198,1
179 close8:close15:goto2
180 print"[147] !!! error found !!! ";
181 printspc(4)"the error is at location :[146]"c:goto178
182 rem *** check for erasure ***
184 print"[147]"spc(13)"check erasure"
186 a=0:poke56835,128:poke57091,255:rem* set ports for read *
187 poke56834,254
188 gosub 1000
196 poke56834,254
197 x=((2^a)*1024)-1
198 printspc(8)"press key when ready":poke198,0:wait198,1
199 printspc(12)"location:":printspc(13)"logo = abort"
200 forc=0 to x
201 if peek(653)=2 thenc=x:goto210
202 li=15:co=21:gosub260:
203 printleft$(sp$,7-len(str$(c)))c
204 ah=int(c/256):al=c-(ah*256)
205 poke56832,al:poke56833,ah
206 poke56834,8
207 d=peek(57089)
208 poke56834,254
209 if d<>255 then 212
210 next c:ifd<>255then212
211 printspc(8)"eprom erased":goto213
212 printspc(7)"eprom is not erased !!"
213 printspc(9)"press key for menu":poke198,0:wait198,1:goto2
214 rem *** directory ***
216 print"[147]"spc(12)"disk directory"
218 print" shift=pause[146]"spc(9)"logo=menu[146]"
219 open1,8,0,"$0"
220 get#1,a$,b$
221 get#1,a$,b$
222 get#1,a$,b$
223 c=0:u$=""
224 if a$<>"" then c=asc(a$+chr$(0))
225 if b$<>"" then c=c+asc(b$+chr$(0))*256
226 printright$(sp$,9-len(str$(c)))c" ";
227 get#1,b$:if st<>0 then 237
228 if b$<>chr$(34) then 227
229 get#1,b$:if b$<>chr$(34)thenu$=u$+b$:b$="":goto229
230 get#1,b$:if b$=chr$(32) then230
231 printchr$(34)u$right$(sp$,16-len(u$))chr$(34)" ";:c$=""
232 c$=c$+b$:get#1,b$:if b$<>"" then232
233 printleft$(c$,3)
234 ifpeek(653)=1then234
235 ifpeek(653)=2thenclose1:goto2
236 if st=0 then 221
237 print" blocks free"
238 printspc(11)"press key for menu":poke198,0:wait198,1
239 close1:goto 2
240 rem **** display disk file ******
242 print"[147]"spc(9)"display disk file"
244 print" shift=pause[146]"spc(9)"logo=menu"
245 h$="0123456789abcdef"
246 input" file name[146]";n$
247 open8,8,8,n$+",p,r"
248 get#8,a$:get#8,a$
249 for t= 0 to 8191
250 for r= 0 to 7
251 get#8,a$:ifa$=""thena$=chr$(0)
252 d=asc(a$)
253 q=int(d/16):w=d-(q*16)
254 d$=mid$(h$,q+1,1)+mid$(h$,w+1,1)
255 printd$;" ";
256 next r
257 if peek (653)=2 then close8:goto2
258 if peek (653)=1 then 258
259 print:next t
260 poke211,co:poke214,li:sys58732:return
270 :
1000 print"select eprom size"
1010 print" 1 2k"
1020 print" 2 4k"
1030 print" 3 8k"
1040 print" 4 16k"
1050 print" 5 32k"
1060 poke198,0:wait198,1
1070 geta$:a=val(a$):ifa<1ora>5then1060
1080 return